import { AxiosPromise } from "axios";
import service from "@/utils/request";
const { systemService } = service;
import { authenticationList, authmanageFormType } from "./type";


/** 
 * 用户认证删除
 * @param {string} id 
  * @returns
 */
export function deleteById(id: number): AxiosPromise<any> {
  return systemService.delete(`/system/authmanage/delete/${id}`);
}

/**
 * 获取分页列表
 *
 * @param queryParams
 */
export function getUserPage(data: authenticationList): AxiosPromise<any> {
  return systemService({
    url: "/system/authmanage/page",
    method: "post",
    data: data,
  });
}

/**
 * 删除信息
 */

export function deleteUserPage(ids: number[]): AxiosPromise<any> {
  return systemService({
    url: "/system/authmanage/deletemore",
    method: "delete",
    data: ids,
  });
}

/**
 * 分配角色列表
 */

export function distributeRole(): AxiosPromise<any> {
  return systemService({
    url: "/system/authmanage/roles",
    method: "get",
  });
}

/** 
 * 用户认证审批
 * @param {object} params 用户认证审批表单
 * @param {number} params.id 认证记录id
 * @param {string} params.status 认证状态,可用值:waiting,pass,failed
 * @param {array} params.roleList 分配对应角色名
 * @returns
 */
export function manage(params: authmanageFormType): AxiosPromise<any> {
  return systemService.post(`/system/authmanage/manage`, params);
}
